<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        function ajaxtest(){
            var request=new XMLHttpRequest();
            request.onreadystatechange=function (){
                if(request.readyState==4 && request.status==200){
                    document.getElementById("id1").value=request.responseText
                }
            }
            request.open("POST","/hello?username=zhangsan")
            request.send()
        }
    </script>
</head>
<body>
    <button onclick="ajaxtest()">按钮</button>
    <input type="text" id="id1">
</body>
</html>